package com.whjfxx.terminal.base;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by b.c on 2022/4/27 16:27
 */
@RestController
public class BaseController {

    @Autowired
    HttpServletRequest httpServletRequest;

    protected Long getUserId() {
        String userId_str = httpServletRequest.getHeader("userId");
        if (null == userId_str || 0 == userId_str.length()) {
            return null;
        }
        return Long.parseLong(userId_str);

    }

}
